
(*
 *******************************************************
	Package: Special
	Author:  Janos Karsai
	Address: Dept. Medical Informatics,
		 University of Szeged
	         H-6720, Szeged, Hungary
	E-mail:  karsai@dmi.u-szeged.hu
 *******************************************************
*)

(*
Package for solution and visualization of differential equations
version: Mathematica 3.0
*)


(*
*******************************************************
Developed for the book -CDRom: 

	Models of Impulsive systems

	Typotex, Budapest, 2002

* Development is supported by 
* Foundation for the Hungarian Higher Education Research, Grant No. 776/94
* Foundation for the Development of Higher Education Grant No. FEFA-IV 1608/4.
* Hungarian Science Research Foundation OTKA T-034275 
* Hungarian Ministry of Education: Project o. 179/1996
* Pro Renovanda Cultura Hungarie: "Science in Education"
* Hungarian Ministry of Education: Higher Education Textbook Grant, 2001
*
*******************************************************
*)


(* COPYRIGHT_BEGIN
*  Copyright (c) 2002 János Karsai,
*  Department of Medical Informatics, University of Szeged
*
*    
*  Permission to use, copy, modify, distribute, and sell this software and its documentation
*  for any purpose is hereby granted without fee, provided that (i) the above copyright 
*  notices and this permission notice appear in all copies of the software and related
*  documentation, and (ii) the name J. Karsai may not be used in 
*  any advertising or publicity relating to the software without the specific, prior written 
*  permission of J. Karsai.
*    
*  THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY
*  KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT 
*  LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR
*  A PARTICULAR PURPOSE.
*    
*  IN NO EVENT SHALL J. KARSAI BE LIABLE FOR ANY SPECIAL,
*  INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
*  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
*  OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF 
*  DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN 
*  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* COPYRIGHT_END 
*)


(* odd powers*)
NPow[x_,n_]=Abs[x]^n*Sign[x]; NPow'[x_,n_]=n*Abs[x]^(n-1);

(* Special derivatives *)
Abs'[x_]:=Sign[x]; Sign'[x_]:=0;

(*The Jacobian of f with respect to var*)
JMf[f_,var_]:= Table[Table[D[f[[j]],var[[i]]],{i,1,Length[var]}], {j,1,Length[f]}];

Grad[f_,var_]:=Table[D[f,var[[i]]],{i,1,Length[var]}];

(* The trace of the matrix *)
Tracef[Mf_]:=Apply[Plus,Table[Mf[[i,i]],{i,1,Length[Mf]}]];

Coordinate[data_, n_] := Map[{#[[1]], #[[n]]} &, data]

Coordinate[data_, {n_, m_}] := Map[{#[[n]], #[[m]]} &, data]

ListPlot1[data_List, opt___] := 
  Show[Map[ListPlot[#, DisplayFunction -> Identity, opt] &, data],DisplayFunction -> $DisplayFunction]